Component({
  data: {
    selected: 0,
    color: "#7A7E83",
    selectedColor: "#3cc51f",
    list: [{
      pagePath: "/pages/index/index",
      iconPath: "/resource/images/tab_home1.png",
      selectedIconPath: "/resource/images/tab_home2.png",
      text: "首页"
    }, {
      pagePath: "/pages/main/main",
      iconPath: "/resource/images/tab_add.png",
      selectedIconPath: "/resource/images/tab_add.png",
    }, {
      pagePath: "/pages/me/index",
      iconPath: "/resource/images/tab_me1.png",
      selectedIconPath: "/resource/images/tab_me2.png",
      text: "我的"
    }]
  },
  attached() { },
  methods: {
    switchTab(e) {
      const data = e.currentTarget.dataset
      const url = data.path
      console.log(data);
      // wx.navigateTo({url})
      wx.switchTab({url })
      this.setData({
        selected: data.index
      })
      console.log(this.data);

    }
  },
  

  // pageLifetimes: {
  //   show() {
  //     if (typeof this.getTabBar === 'function' && this.getTabBar()) {
  //       this.getTabBar().setData({
  //         selected: 0
  //       })
  //     }
  //   }
  // }
})